import lessModule from "./index.module.less"
import rightArrowImage from "../../../../assets/image/homePage-rightArrow.png"
import { $eventBus } from "../../../../common/utils";

// 主页-单选按钮组件
interface myInterface {
    operation?:string
    selectedValue: string
    minWidth?: number | string
    monitoringType: string
    monitorModalName: string
}

const HomePage_SingleBtnComponent: React.FC<myInterface> = (props) => {
    const click_btn = () => {
        setTimeout(() => {
            $eventBus.emit("openSelectMonitorModal", { mode: "single",operation:props.operation ?? "安装", monitoringType: props.monitoringType, modalName: props.monitorModalName, selectedList: props.selectedValue ? [props.selectedValue] : [] })
        });
    }
    return (
        <div className={lessModule["homePageSingleBtnComponent"]} style={{ minWidth: props.minWidth ?? "100%", cursor: props.monitoringType ? "pointer" : "not-allowed" }} onClick={() => props.monitoringType && click_btn()}>
            <span style={{ color: props.selectedValue ? "rgba(0, 0, 0, 0.65)" : "rgba(0, 0, 0, 0.25)" }}>{props.selectedValue ? props.selectedValue : "请选择"}</span>
            <img src={rightArrowImage} />
        </div>
    )
}


export default HomePage_SingleBtnComponent